// components/navigation/navigation.ts
Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  properties: {
    background: {
      type: String,
      value: '#fff',
    },
    color: {
      type: String,
      value: '',
    },
    back: {
      type: Boolean,
      value: true,
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    style: '',
    sideWidth: 0,
    leftWidth: 0,
    isPC: false
  },

  attached() {
    const isSupport = !!wx.getMenuButtonBoundingClientRect;
    const rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null;
    wx.getSystemInfo({
      success: (res) => {
        const ios = !!(res.system.toLowerCase().search('ios') + 1);
        const sideWidth = isSupport ? res.windowWidth - rect!.left : 0;
        let statusBarHeight = res.statusBarHeight
        if (res.platform === "windows" || res.platform === "mac") {
          statusBarHeight = 0
          this.setData({
            isPC: true
          })
        }

        this.setData({
          ios,
          sideWidth: this.data.sideWidth || sideWidth,
          statusBarHeight,
          leftWidth: res.windowWidth - rect!.left
        });


      },
    });
  },
  methods: {

  }
})